package com.zyn.java.config;


import java.util.concurrent.TimeUnit;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import lombok.extern.slf4j.Slf4j;
import okhttp3.ConnectionPool;

@Configuration
@Slf4j
public class ClientConfig {
    @Bean
    public okhttp3.OkHttpClient okHttpClient() {
        log.info("the feign client use okHttpClient");
        return new okhttp3.OkHttpClient.Builder()
            .readTimeout(10, TimeUnit.SECONDS)
            .connectTimeout(10, TimeUnit.SECONDS)
            .writeTimeout(10, TimeUnit.SECONDS)
            .connectionPool(new ConnectionPool(5, 5, TimeUnit.MINUTES))
            .build();
    }
}
